package Message;
import java.awt.Color;
import java.awt.Container;
import java.awt.EventQueue;
import java.awt.Font;

import javax.swing.JFrame;
import java.awt.FlowLayout;

import javax.swing.JOptionPane;
import javax.swing.JTree;
import javax.swing.JButton;
import javax.swing.JLabel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextField;

public class UsingMessageBox_1 {

	public JFrame frame;
	private JTextField textField;
	Integer count = 0;

	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					UsingMessageBox_1 window = new UsingMessageBox_1();
					window.frame.setVisible(false);
					window.x();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});

	}

	public UsingMessageBox_1() {
		initialize();
	}

	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		final Container con = frame.getContentPane();
		con.setLayout(null);
		final JLabel lblNewLabel = new JLabel("(=^ ^=) 输错了!");
		lblNewLabel.setBounds(214, 130, 120, 15);
		lblNewLabel.setFont(new Font("Serief", Font.BOLD, 14));
		lblNewLabel.setForeground(Color.RED);// 设置标签前景色
		lblNewLabel.setVisible(false);
		textField = new JTextField();
		textField.setBounds(60, 25, 198, 48);
		JButton btnNewButton = new JButton("点击");

		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				count++;
				if (count % 2 == 0) {
					lblNewLabel.setVisible(true);
				} else
					lblNewLabel.setVisible(false);
			}
		});
		btnNewButton.setBounds(72, 107, 120, 41);
		con.add(btnNewButton);
		con.add(textField);
		con.add(lblNewLabel);
		textField.setColumns(5);
	}
	public void x() {
		int i = 0;
		if (i == 0) {
			// JOptionPane.showMessageDialog(null, "你好", "兔兔", 2);
			JOptionPane j = new JOptionPane();
			j.showOptionDialog(null, "caonima", "title1989", -1, 2, null, null,
					null);
			return;
		}
		System.out.println("哈哈哈哈哈哈哈哈哈哈");
	}

}
